package com.example.m_kartupay;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.app.Activity;
import android.content.Intent;

public class SettingActivity extends Activity {

	 ListView list;
	 String[] setting = {
			      "Edit Profile", 
			      "Change Email",
			      "Change Password",
			      "Change PIN",
			      "Forgot PIN"
			         	      
     } ;
	 Integer[] imageId = {
			  R.drawable.ic_person,
		      R.drawable.ic_email,
		      R.drawable.ic_password,
		      R.drawable.ic_change_pin,
		      R.drawable.ic_change_pin
		     
		     
		     		   
			
		  };
	 @Override
	  protected void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.settings);
	    ListMenuActivity adapter = new
	    		ListMenuActivity(SettingActivity.this, setting, imageId);
	    list=(ListView)findViewById(R.id.listsetting);
	        list.setAdapter(adapter);
	        list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
	                @Override
	                public void onItemClick(AdapterView<?> parent, View view,
	                                        int position, long id) {
	                    Toast.makeText(SettingActivity.this, "You Clicked at " +setting[+ position], Toast.LENGTH_SHORT).show();
	                    String _menu = setting[+position];
	                   // Toast.makeText(MainMenuActivity.this, "You Clicked at " +menu[+ position], Toast.LENGTH_SHORT).show();
	                    
	                    // Buat Switch untuk pemilihan intent
	                    
	                    
	                   switch(_menu)
	                   {
		                  
		                   case "Change PIN":
		                	   Intent changePin =  new Intent(view.getContext(), ChangePINActivity.class);
		                	   startActivity(changePin);
		                	   break;
		                  
		                   
	                   }                  
	                 	                    
	                    
	    				//in.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
	    			    //in.putExtra("kirim", "Hallo Saya dari FirstActivity");
	    			   
	    			    
	                
	                }
	            });
	  }
}
